package com.zjq.smartdevice.mapper;

import com.zjq.smartdevice.pojo.SysUserOnline;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @User zhangjiaqi
 * @Project project
 * @Package com.zjq.smartdevice.mapper
 * @Date 2022/3/18 19:38
 */
public interface SysUserOnlineMapper {

    @Insert("insert into sys_user_online values (#{sessionId},#{loginName},#{ipaddr},#{loginLocation},#{browser},#{os},#{status},#{startTimestamp},#{lastAccessTime},#{expireTime})")
    void addSysUserOnline(SysUserOnline sysUserOnline);

    @Select("select count(*) from sys_user_online where login_name=#{loginName}")
    int findByUserName(String loginName);

    @Update("update sys_user_online set sessionId=#{sessionId},ipaddr=#{ipaddr},login_location=#{loginLocation},browser=#{browser},os=#{os},status={status},start_timestamp=#{startTimestamp},last_access_time=#{lastAccessTime},expire_time=#{expireTime} where login_name=#{loginName}")
    void updateSysUserOnline(SysUserOnline sysUserOnline);
}
